import java.util.Scanner;

abstract class Employee {
    protected static final int BASIC_SALARY = 3000;
    protected int complaintCount;

    public Employee(int complaintCount) {
        this.complaintCount = complaintCount;
    }

    public abstract int calculateBonus();

    public int calculateDeduction() {
        return complaintCount * 50;
    }

    public int calculateSalary() {
        return BASIC_SALARY + calculateBonus() - calculateDeduction();
    }

    public abstract String getSalaryDetails();
}

class Chef extends Employee {
    private int dishesCooked;

    public Chef(int complaintCount, int dishesCooked) {
        super(complaintCount);
        this.dishesCooked = dishesCooked;
    }

    @Override
    public int calculateBonus() {
        return dishesCooked * 10;
    }

    @Override
    public String getSalaryDetails() {
        return String.format(
                "员工类型：厨师\n" +
                        "底薪：%d元\n" +
                        "奖金：%d元（炒菜份数×10）\n" +
                        "扣款：%d元（投诉次数×50）\n" +
                        "总薪资：%d元",
                BASIC_SALARY, calculateBonus(), calculateDeduction(), calculateSalary()
        );
    }
}

class Waiter extends Employee {
    private int tablesServed;

    public Waiter(int complaintCount, int tablesServed) {
        super(complaintCount);
        this.tablesServed = tablesServed;
    }

    @Override
    public int calculateBonus() {
        return tablesServed * 5;
    }

    @Override
    public String getSalaryDetails() {
        return String.format(
                "员工类型：服务员\n" +
                        "底薪：%d元\n" +
                        "奖金：%d元（服务桌数×5）\n" +
                        "扣款：%d元（投诉次数×50）\n" +
                        "总薪资：%d元",
                BASIC_SALARY, calculateBonus(), calculateDeduction(), calculateSalary()
        );
    }
}

public class SalarySystem {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("==== 传智餐厅薪资查询系统 ====");
        System.out.println("请选择员工类型：");
        System.out.println("1. 厨师");
        System.out.println("2. 服务员");
        System.out.print("请输入选项：");
        int choice = scanner.nextInt();

        System.out.print("\n请输入本月有效投诉次数：");
        int complaints = scanner.nextInt();

        Employee employee = null;

        if (choice == 1) {
            System.out.print("请输入本月炒菜份数：");
            int dishes = scanner.nextInt();
            employee = new Chef(complaints, dishes);
        } else if (choice == 2) {
            System.out.print("请输入本月服务桌数：");
            int tables = scanner.nextInt();
            employee = new Waiter(complaints, tables);
        } else {
            System.out.println("无效选项！");
            System.exit(1);
        }

        System.out.println("\n==== 薪资明细 ====");
        System.out.println(employee.getSalaryDetails());

        scanner.close();
    }
}